# encoding: utf-8
from flask_marshmallow import base_fields
from flask_restplus_patched import Parameters


class Default(Parameters):
    pass


class UserParameters(Parameters):
    id = base_fields.String(
        description = "用户ID",
        missing = None,  # default value
    )
    token_id = base_fields.String(
        description = "登陆ID",
        required = True,
    )
    role_name = base_fields.String(
        description = "角色名称",
        missing = None,  # default value
    )
    withRole = base_fields.Boolean(
        description = "是否返回角色",
        required = False,
        missing = False,  # default value
    )


class AddRoleForUserParameters(Parameters):
    id = base_fields.String(
        required = True,
        description = "用户ID",
    )
    token_id = base_fields.String(
        description = "登陆ID",
        required = True,
    )
    role_name = base_fields.String(
        description = "角色名称",
        required = True,
    )


class UserAddParameters(Parameters):
    account = base_fields.String(
        description = "用户名",
        required = True,
    )
    realname = base_fields.String(
        description = "真实姓名",
        required = False,
        missing = None
    )
    role = base_fields.String(
        description = "用户角色列表(角色ID)",
        required = True,
    )
    password = base_fields.String(
        description = "密码(明文密码，后台加密)",
        required = True,
    )
    token_id = base_fields.String(
        description = "登陆ID",
        required = True,
    )
    email = base_fields.String(
        description = "邮箱",
        missing = None,
    )


class UserUpdateParameters(Parameters):
    id = base_fields.String(
        description = "用户ID",
        required = True,
    )
    role_list = base_fields.String(
        required = True,
        description = "用户角色列表(角色ID)",
    )
    update_pass = base_fields.Boolean(
        description = "是否修改密码",
        required = True,
        missing = False
    )
    old_password = base_fields.String(
        description = "旧密码(明文密码，后台加密)",
        missing = None,  # default value
    )
    new_password = base_fields.String(
        description = "新密码(明文密码，后台加密)",
        missing = None,  # default value
    )
    realname = base_fields.String(
        description = "真实姓名",
        missing = None,
    )
    account = base_fields.String(
        description = "用户名",
        required = True
    )
    token_id = base_fields.String(
        description = "登陆ID",
        required = True,
    )
    email = base_fields.String(
        description = "邮箱",
        missing = None,
    )


class UserDelParameters(Parameters):
    id = base_fields.String(
        description = "用户ID",
        required = True,
    )
    token_id = base_fields.String(
        description = "登陆ID",
        required = True,
    )


class ResetUserPassParameters(Parameters):
    account = base_fields.String(
        description = "用户登录名",
        required = True,
    )
    token_id = base_fields.String(
        description = "登陆ID",
        required = True,
    )
